import { reqEcharts } from '@/api/table'
const state = {
  // x轴的数据
  orderFullYearAxis: [],
  // 所以数据
  echartsinfo: {},
  // 存放销量的x轴
  userFullYearAxis: []
}
const mutations = {
  AXIS(state, data) {
    state.orderFullYearAxis = data
  },
  ECHARTSINFO(state, data) {
    state.echartsinfo = data
  },
  USERFULLYEARAXIS(state, data) {
    state.userFullYearAxis = data
  }
}
const actions = {
  getEcahrts({ commit }) {
    reqEcharts().then((res) => {
      console.log(res)
      commit('AXIS', res.data.orderFullYearAxis)
      commit('ECHARTSINFO', res.data)
      commit('USERFULLYEARAXIS', res.data.userFullYearAxis)
    })
  }
}
export default {
  state,
  mutations,
  actions
}
